import { memo } from 'react'
import { Navigate } from 'react-router-dom'

const AuthRequire = memo(({children}) => {
  const check = (localStorage.getItem('userToken') && localStorage.getItem('account_status') === '1') ? true : false

  if (check) {
    return <>{children}</>
  } else {
    return <Navigate to="/login" replace />;
  }
})

export default AuthRequire

